package oop.core.area;
import oop.core.entity.Entity;


/**
 * This is the AreaEffect for setting effects that heals entities 
 */
public class HealAreaEffect extends AreaEffect {
	
	private int amountHealed;
	
	/**
	 * @param isOn If the AreaEffect is active
	 * @param delay How long between each time the AreaEffect takes effect
	 * @param heal The amount healed per tick
	 */
	public HealAreaEffect(boolean isOn, long delay, int amountHealed) {
		super(isOn, delay);
		this.amountHealed = amountHealed;
	}
	
	/**
	 * Heals the entity by the amount specified in the AE's heal attribute
	 * @param ent The entity being affected by the areaEffect
	 * @return Returns if the effect happened (based on isOn)
	 */
	public boolean doEffect(Entity ent)
	{
		if(isOn)
		{
			ent.heal(amountHealed);
			isOn = false;
			return true;
		} else
		{
			return false;
		}
	}
}